package com.vxdata.utils.modules.excel.easypoi;

import cn.hutool.core.util.StrUtil;
import com.vxdata.common.core.domain.AjaxResult;
import com.vxdata.utils.modules.excel.easypoi.util.EasyPoiUtil;
import com.vxdata.utils.modules.excel.easypoi.vo.OrderRepairExcelVo;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;

public class ExcelServiceImpl {

    /**
     * 实体list导出excel
     *
     * @return
     */
    public AjaxResult repairListExport() {
        List<OrderRepairExcelVo> list = new ArrayList<>();
        // 设置文件名称
        String fileName = StrUtil.format("维护工单列表导出_{}.xls", DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss").format(LocalDateTime.now()));
        EasyPoiUtil.exportExcelToLocal(list, null, null, OrderRepairExcelVo.class, fileName);
        return AjaxResult.success(fileName);
    }
}
